var http = require('http');
var events = require('events');
var UserBean = require('./models/UserBean');
http.createServer(function(request, response) {
  response.writeHead(200, {'Content-Type':'text/html; charset=utf-8'});
  if(request.url !== "/favicon.ico") {
    user = new UserBean();
    user.eventEmit.once('registSuc', function(uname,pwd) {
      response.write('注册成功');
      console.log('pass uname : ' + uname);
      console.log('pass pwd : ' + pwd);
      user.login(request, response);
      response.end();
    }); //注册监听
    user.regist(request, response);
  }
}).listen(8000);
console.log('Server Running at http://127.0.0.1:8000');
